import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooCrontabController } from '../../../controllers';
const uctoocrontabRouter = new Router();
const crontabController = new uctooCrontabController();

uctoocrontabRouter.post('/add', requireUser, crontabController.add);
uctoocrontabRouter.post('/edit', requireUser, rowLevelPermission('uctoo/crontab'), crontabController.edit);
uctoocrontabRouter.post('/del', requireUser, rowLevelPermission('uctoo/crontab'), crontabController.delete);

//For getting crontab with permission control
uctoocrontabRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/crontab'), crontabController.getSingle);
uctoocrontabRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/crontab'), crontabController.getMany);
uctoocrontabRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/crontab'), crontabController.getMany);

//#endregion AutoCreateCode
export default uctoocrontabRouter;
